from functools import wraps

class AuthClass:
    def __init__(self, name, pwd):
        self.name = name
        self.pwd = pwd

    def auth(self):
        if self.name == 'python' and self.pwd == '123':
            return True
        else:
            return False

user = AuthClass('python','6123')

def auth_before(f):
    @wraps(f)
    def inner(*args, **kwargs):
        if not user.auth():
            print("用户名或密码错误")
            return False
        else:
            return f(*args, **kwargs)
    return inner

@auth_before
def p1():
    return "this is p1 function"
print(p1())